﻿
using System.Collections.Generic;
using Microsoft.Xna.Framework.Input;
namespace Kikooland
{
    /// <summary>
    /// Gère tous les objets de la map monde (mobs, objets divers, décor ...)
    /// L'instance est un singleton
    /// </summary>
    public class World
    {
        private static World _instance;

        public static World GetInstance()
        {
            if (_instance == null)
                _instance = new World();
            return _instance;
        }

        public List<Mob> Mobs { get; set; }

        public World()
        {
            Mobs = new List<Mob>();
        }

        public Mob GetPointedMob(MouseState mouse)
        {
            foreach (var mob in Mobs)
            {
                if (mouse.X > mob.Position.X && mouse.X < mob.Position.X + mob.Texture.Width &&
                    mouse.Y > mob.Position.Y && mouse.Y < mob.Position.Y + mob.Texture.Height)
                    return mob;
            }
            return null;
        }
    }
}
